<?php

/*
 * @Filename     : WB_Dictionary
 * @Author       : shuangbrother
 * @Email        : shuangbrother@126.com
 * @create_at    : 2016-1-11
 * @Description  : 
 */

namespace frontendw\models;

use common\models\Dictionary;

class WB_Dictionary extends Dictionary {
    
    /*
     * 查询字典顶级数据集
     * return array
     */
    public static function getDictDropdownList($column_id = 0) {
        $res = WB_Dictionary::find()->where(["column_id" => $column_id])->all();
        $temp = [];
        if ($res) {
            foreach ($res as $item) {
                $temp[$item["id"]] = $item["name"];
            }
        }
        return $temp;
    }
    /*
     * 查询字典数据列表
     * @params $column_id
     * return object
     */
    public static function getDictData($column_id = 0){
        return WB_Dictionary::find()->where(["column_id" => $column_id])->all();
    }
}
